import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
import RouteGuard from "../components/RouteGuard";

import { HomeO, FriendsO, UserO } from '@react-vant/icons'
const App = lazy(() => import("../App"));
const One = lazy(() => import("../Page/One"));

const Login = lazy(() => import("../Page/Login"));
const ZhuCe = lazy(() => import("../Page/ZhuCe"));

// 恢复医生列表页面（问专家）
const DiseaseDetail = lazy(() => import("../Page/DiseaseDetail"));
// 医生列表页面
const DoctorList = lazy(() => import("../Page/DoctorList"));
// 医生详情页面
const DoctorDetail = lazy(() => import("../Page/DoctorDetail"));
// 关注的医生列表页面
const FollowedDoctors = lazy(() => import("../Page/FollowedDoctors"));
// 药品详情页面
const DrugDetail = lazy(() => import("../Page/DrugDetail"));

// 病友圈主页面
const SickCircle = lazy(() => import("../Page/SickCircle/index"));

// 视频页面


const Message = lazy(() => import("../Page/Message"));
const Search = lazy(() => import("../Page/Search"));
const SickCircleDetail = lazy(() => import("../Page/SickCircleDetail"));
const InformationDetail = lazy(() => import("../Page/InformationDetail"));
const PingLun = lazy(() => import("../Page/PingLun"));
const SickCirclePublish = lazy(() => import("../Page/SickCirclePublish"));

const Cases = lazy(() => import("../Page/Cases"));
const Mine = lazy(() => import("../Page/Mine"));
const Fen = lazy(() => import("../Page/Fen"));
const PermissionTest = lazy(() => import("../Page/PermissionTest"));
// 人脸库管理页面
const FaceManage = lazy(() => import("../Page/FaceManage"));
const ChangePassword = lazy(() => import("../Page/ChangePassword"));

// 更多服务页面
const MoreServices = lazy(() => import("../Page/MoreServices"));

// 健康资讯页面
const HealthInfo = lazy(() => import("../Page/HealthInfo"));

// 健康资讯详情页面
const HealthInfoDetail = lazy(() => import("../Page/HealthInfoDetail"));

// 预约须知页面
const AppointmentNotice = lazy(() => import("../Page/AppointmentNotice"));

// 院区列表页面
const CampusList = lazy(() => import("../Page/CampusList"));

// 科室列表页面
const DepartmentList = lazy(() => import("../Page/DepartmentList"));

// 确认预约页面
const ConfirmAppointment = lazy(() => import("../Page/ConfirmAppointment"));
// 挂号详情
const RegistrationDetail = lazy(() => import("../Page/RegistrationDetail"));

// 门诊缴费页面
const OutpatientPayment = lazy(() => import("../Page/OutpatientPayment"));
// 缴费成功详情页面
const PaymentSuccess = lazy(() => import("../Page/PaymentSuccess"));
const PayResult = lazy(() => import("../Page/PayResult"));

// 医院公告页面
const HospitalAnnouncement = lazy(() => import("../Page/HospitalAnnouncement"));

// 公告详情页面
const AnnouncementDetail = lazy(() => import("../Page/AnnouncementDetail"));

// 门诊报告页面
const OutpatientReport = lazy(() => import("../Page/OutpatientReport"));

// 检查报告详情页面
const ExaminationReportDetail = lazy(() => import("../Page/ExaminationReportDetail"));

// 检验报告详情页面
const TestReportDetail = lazy(() => import("../Page/TestReportDetail"));

// OAuth回调页面
const GiteeCallback = lazy(() => import("../Page/Auth/GiteeCallback"));
const Two = lazy(() => import("../Page/Two"));

export const Zi = [
    {
        path: "one",
        element: <One />,
        title: "就医",
        icon: <HomeO />
    },
    // 人脸库管理（作为 /app 的子路由，需使用相对路径）
   
    {
        path: "two",
        element: <Two />,
        title: "信息",
        icon: <HomeO />
    },
  

    {
        path: "cases",
        element: <Cases />,
        title: "视频",
        icon: <FriendsO />
    },
    {
        path: "mine",
        element: <Mine />,
        title: "我的",
        icon: <UserO />
    }
]

const router = createBrowserRouter([
    {
        path: "/",
        element: <RouteGuard><App /></RouteGuard>,
        children: [
            {
                index: true,
                element: <One />
            }
        ]
    },
    {
        path: "/app",
        element: <RouteGuard><App /></RouteGuard>,
        children: Zi
    },
      {
        path: "message",
        element: <RouteGuard><Message /></RouteGuard>,
      
       
    },
    {
        path: "/login",
        element: <Login />
    },
    {
        path: "/zhuce",
        element: <ZhuCe />
    },
    // OAuth回调路由
    {
        path: "/auth/gitee/callback",
        element: <GiteeCallback />
    },
    // 问专家（医生列表）
    {
        path: "/disease-detail",
        element: <RouteGuard><DiseaseDetail /></RouteGuard>
    },
    // 医生列表页面
    {
        path: "/doctor-list",
        element: <RouteGuard><DoctorList /></RouteGuard>
    },
    // 医生详情页面
    {
        path: "/doctor-detail/:doctorId",
        element: <RouteGuard><DoctorDetail /></RouteGuard>
    },
    // 关注的医生列表页面
    {
        path: "/followed-doctors",
        element: <RouteGuard><FollowedDoctors /></RouteGuard>
    },
    // 疾病详情页面
    {
        path: "/disease-detail/:id",
        element: <RouteGuard><DiseaseDetail /></RouteGuard>
    },
    // 药品详情页面
    {
        path: "/drug-detail/:id",
        element: <RouteGuard><DrugDetail /></RouteGuard>
    },
    // 病友圈主页面
    {
        path: "/sick-circle",
        element: <RouteGuard><SickCircle /></RouteGuard>
    },
    // 视频页面


    {
        path: "/information-detail",
        element: <RouteGuard><InformationDetail /></RouteGuard>
    },

    {
        path: "/search",
        element: <RouteGuard><Search /></RouteGuard>
    },
    // 病友圈详情页面
    {
        path: "/sick-circle-detail/:id",
        element: <RouteGuard><SickCircleDetail /></RouteGuard>
    },
    {
        path: "/fen",
        element: <RouteGuard><Fen /></RouteGuard>
    },
    {
        path: "/pinglun",
        element: <RouteGuard><PingLun /></RouteGuard>
    },
    {
        path: "/sick-circle-publish",
        element: <RouteGuard><SickCirclePublish /></RouteGuard>
    },
    {
        path: "/permission-test",
        element: <RouteGuard><PermissionTest /></RouteGuard>
    },
    {
        path: "/change-password",
        element: <RouteGuard><ChangePassword /></RouteGuard>
    },
    // 更多服务页面
    {
        path: "/more-services",
        element: <RouteGuard><MoreServices /></RouteGuard>
    },
    // 健康资讯页面
    {
        path: "/health-info",
        element: <RouteGuard><HealthInfo /></RouteGuard>
    },
    // 健康资讯详情页面
    {
        path: "/health-info-detail/:id",
        element: <RouteGuard><HealthInfoDetail /></RouteGuard>
    },
    // 预约须知页面
    {
        path: "/appointment-notice",
        element: <RouteGuard><AppointmentNotice /></RouteGuard>
    },
    // 院区列表页面
    {
        path: "/campus-list",
        element: <RouteGuard><CampusList /></RouteGuard>
    },
    // 科室列表页面
    {
        path: "/department-list",
        element: <RouteGuard><DepartmentList /></RouteGuard>
    },
    // 确认预约
    {
        path: "/confirm-appointment",
        element: <RouteGuard><ConfirmAppointment /></RouteGuard>
    },
    // 挂号详情
    {
        path: "/registration-detail",
        element: <RouteGuard><RegistrationDetail /></RouteGuard>
    },
    // 门诊缴费页面
    {
        path: "/outpatient-payment",
        element: <RouteGuard><OutpatientPayment /></RouteGuard>
    },
    // 缴费成功详情页面
    {
        path: "/payment-success",
        element: <RouteGuard><PaymentSuccess /></RouteGuard>
    },
    // 医院公告页面
    {
        path: "/hospital-announcement",
        element: <RouteGuard><HospitalAnnouncement /></RouteGuard>
    },
    // 公告详情页面
    {
        path: "/announcement-detail/:id",
        element: <RouteGuard><AnnouncementDetail /></RouteGuard>
    },
    // 门诊报告页面
    {
        path: "/outpatient-report",
        element: <RouteGuard><OutpatientReport /></RouteGuard>
    },
    // 检查报告详情页面
    {
        path: "/examination-report-detail/:id",
        element: <RouteGuard><ExaminationReportDetail /></RouteGuard>
    },
    // 检验报告详情页面
    {
        path: "/test-report-detail/:id",
        element: <RouteGuard><TestReportDetail /></RouteGuard>
    },
    // 消息页面（独立路由）
    {
        path: "/message",
        element: <RouteGuard><Message /></RouteGuard>
    },
    // 支付结果轮询页（独立）
    {
        path: "/pay-result",
        element: <PayResult />
    },
    // 人脸库管理（独立路径）
    {
        path: "/face-manage",
        element: <RouteGuard><FaceManage /></RouteGuard>
    },

])
export default router